Render to texture
Here's the code from in class:
- texture.frag This has some example effects.
-
In RenderEngine.h, display(), near
//activate our new framebuffer
, changeglBindFramebuffer(GL_FRAMEBUFFER, 0);
toglBindFramebuffer(GL_FRAMEBUFFER, frameBuffer);
-
In RenderEngine.h, display(), near
//default framebuffer
uncomment the call toglClearColor
andglClear
. -
In RenderEngine.h, display(),
uncomment the call to
glDrawArrays(GL_TRIANGLES, 0, 6);
.